package com.mornd.gulimall.product.test;

import com.mornd.gulimall.product.entity.SpuInfo;
import com.mornd.gulimall.product.service.ISpuInfoService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @author: mornd
 * @dateTime: 2023/8/20 - 11:46
 */
@SpringBootTest
public class EsOps {
    @Autowired
    private ISpuInfoService spuInfoService;

    @Test
    public void upAllSku() {
        List<SpuInfo> list = spuInfoService.list();
        if(list.isEmpty()) {
            System.out.println("spu为空");
            return;
        }
        for (SpuInfo spuInfo : list) {
            spuInfoService.spuUp(spuInfo.getId());
        }
        System.out.println("操作完成");
    }
}
